﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Bussiness.Service;
using Ext.Net;

namespace Bussiness.View.BackEnd
{
    public partial class BC_DoanhThuCH : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        public void Search(object sender, DirectEventArgs e)
        {
            List<HeaderOrder> list = new Order_Service().GetOrderByMonth(int.Parse(Thang_SelectBox.SelectedItem.Value));
            decimal TotalBuyPrice = 0;
            decimal TotalImportPrice = 0;
            for (int i = 0; i < list.Count;i++ )
            {
                TotalBuyPrice += (decimal)list[i].TotalPrice;
                TotalImportPrice += (decimal)list[i].TotalImportPrice;
            }
            total_buy_price.Value = TotalBuyPrice;
            total_import_price.Value = TotalImportPrice;
            NumberField1.Value = TotalBuyPrice - TotalImportPrice;

            this.DSBH_Store.DataSource = new Order_Service().GetOrderByMonth(int.Parse(Thang_SelectBox.SelectedItem.Value));
            this.DSBH_Store.DataBind();
            this.DSBH_Grid.Title = "Doanh bán hàng của tháng " + Thang_SelectBox.SelectedItem.Text;
        }
    }
}
